Skip to content

[dwds] Add support for --[no-]deprecated-js-interop - #2875

Merged
biggs0125 merged 6 commits into
dart-lang:mainfrom
biggs0125:dwds-deprecated-js-interop
Oct 8, 2026
Merged

biggs0125 merged 6 commits into
dart-lang:mainfrom
biggs0125:dwds-deprecated-js-interop

Conversation

@biggs0125

Copy link
Copy Markdown
Contributor

The Dart SDK added a --[no-]deprecated-js-interop flag to its web compilers (https://dart-review.googlesource.com/c/sdk/+/555460, https://dart-review.googlesource.com/c/sdk/+/555500). With --no-deprecated-js-interop, the compilers reject imports of dart:html, dart:js, dart:js_util, package:js and the other deprecated JS interop libraries.

This plumbs the flag into DWDS's expression evaluation:

  • New field: BuildSettings and CompilerOptions take an optional bool? deprecatedJsInterop. This is a non-breaking addition.
  • Expression compiler worker: started with --[no-]deprecated-js-interop only when the setting is non-null.
  • Testable arguments: the worker arguments are now built by a separate function, expressionCompilerWorkerArgs, so they can be unit-tested.

Corresponding webdev PR: #2874

The Dart SDK added a `--[no-]deprecated-js-interop` flag to its web compilers (https://dart-review.googlesource.com/c/sdk/+/555460, https://dart-review.googlesource.com/c/sdk/+/555500). With `--no-deprecated-js-interop`, the compilers reject imports of `dart:html`, `dart:js`, `dart:js_util`, `package:js` and the other deprecated JS interop libraries.

This plumbs the flag into DWDS's expression evaluation:

- **New field:** `BuildSettings` and `CompilerOptions` take an optional `bool? deprecatedJsInterop`. This is a non-breaking addition.
- **Expression compiler worker:** started with `--[no-]deprecated-js-interop` only when the setting is non-null.
- **Testable arguments:** the worker arguments are now built by a separate function, `expressionCompilerWorkerArgs`, so they can be unit-tested.
biggs0125 pushed a commit to biggs0125/webdev that referenced this pull request Oct 3, 2026
The Dart SDK added a `--[no-]deprecated-js-interop` flag to its web compilers (https://dart-review.googlesource.com/c/sdk/+/555460, https://dart-review.googlesource.com/c/sdk/+/555500). With `--no-deprecated-js-interop`, the compilers reject imports of `dart:html`, `dart:js`, `dart:js_util`, `package:js` and the other deprecated JS interop libraries.

This adds the flag to `webdev serve`, `webdev build` and `webdev daemon`. It matches the flag added to `flutter build web/run/drive/test`.

- **New flag:** `--[no-]deprecated-js-interop`, with `--help` text. If it isn't passed, nothing is forwarded and the SDK default applies, so older SDKs keep working.
- **Forwarded to build_runner** as `--define` for the four build_web_compilers builders that must agree on it: `ddc`, `ddc_modules`, `dart2js_modules` and `entrypoint`. This covers DDC, dart2js, the kernel worker and the Frontend Server (web hot reload). Changing the value invalidates cached outputs through build_runner's option digest.
- **Forwarded to dwds** through `BuildSettings`, so expression evaluation uses the same setting.
- **Version check.** If the flag is passed and the project's `build_web_compilers` is older than 4.9.0, webdev stops early with "could not run with --no-deprecated-js-interop for this project" instead of failing inside build_runner.
- **Error output.** Compiler diagnostics, including dart2js's import tree, come from build_web_compilers and are printed as `[SEVERE]` build logs. No change to webdev's logging.
- README help output is updated.

Depends on DWDS PR: dart-lang#2875
@biggs0125
biggs0125 requested review from Markzipan and nshahan October 5, 2026 17:41
Comment thread dwds/pubspec.yaml Outdated

@Markzipan Markzipan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with some nits

Comment thread dwds/test/services/expression_compiler_worker_args_test.dart
Comment thread dwds/lib/src/services/expression_compiler_service.dart
@biggs0125
biggs0125 merged commit 8daea3b into dart-lang:main Oct 8, 2026
38 checks passed
copybara-service Bot pushed a commit to dart-lang/sdk that referenced this pull request Oct 13, 2026
…piler

Also syncs changes to sockets.dart and client.dart from webdev so that
they are in sync.

New PR: dart-lang/webdev#2875

Old synced change:
dart-lang/webdev@876be56

Change-Id: Ibeb7ba9ecf95233ebc5678837b69192b0622e823
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/559220
Reviewed-by: Jessy Yameogo <yjessy@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
biggs0125 added a commit that referenced this pull request Oct 15, 2026
* [webdev] Add support for --[no-]deprecated-js-interop

The Dart SDK added a `--[no-]deprecated-js-interop` flag to its web compilers (https://dart-review.googlesource.com/c/sdk/+/555460, https://dart-review.googlesource.com/c/sdk/+/555500). With `--no-deprecated-js-interop`, the compilers reject imports of `dart:html`, `dart:js`, `dart:js_util`, `package:js` and the other deprecated JS interop libraries.

This adds the flag to `webdev serve`, `webdev build` and `webdev daemon`. It matches the flag added to `flutter build web/run/drive/test`.

- **New flag:** `--[no-]deprecated-js-interop`, with `--help` text. If it isn't passed, nothing is forwarded and the SDK default applies, so older SDKs keep working.
- **Forwarded to build_runner** as `--define` for the four build_web_compilers builders that must agree on it: `ddc`, `ddc_modules`, `dart2js_modules` and `entrypoint`. This covers DDC, dart2js, the kernel worker and the Frontend Server (web hot reload). Changing the value invalidates cached outputs through build_runner's option digest.
- **Forwarded to dwds** through `BuildSettings`, so expression evaluation uses the same setting.
- **Version check.** If the flag is passed and the project's `build_web_compilers` is older than 4.9.0, webdev stops early with "could not run with --no-deprecated-js-interop for this project" instead of failing inside build_runner.
- **Error output.** Compiler diagnostics, including dart2js's import tree, come from build_web_compilers and are printed as `[SEVERE]` build logs. No change to webdev's logging.
- README help output is updated.

Depends on DWDS PR: #2875

---------

Co-authored-by: Nate Biggs <natebiggs@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants